import os
import sys
import asyncio
import re
import serial

AbsolutePath = os.path.abspath(__file__)
SuperiorCatalogue = os.path.dirname(AbsolutePath)
BaseDir = os.path.dirname(SuperiorCatalogue)
sys.path.insert(0, SuperiorCatalogue)


class Gps:

    def __init__(self):
        self.__serialNormal = serial.Serial("/dev/ttyUSB3", 115200, timeout=1)
        self.__serialGps = serial.Serial('/dev/ttyUSB1', 115200, timeout=1)


async def __cmdRun(command: str) -> str:
    proc = await asyncio.subprocess.create_subprocess_shell(
        command,
        stdout=asyncio.subprocess.PIPE,
        stderr=asyncio.subprocess.DEVNULL,
        shell=True
    )
    std, _, = await proc.communicate()
    return std.decode()
